import fetch from '../../utils/fetch';

let base = '/api/user';

export const page = params => {
    return fetch.get(
        `${base}/page`, 
        { params: params }
    );
};

export const get = params => {
    return fetch.get(
        `${base}/` + params
    );
};

export const update = params => { 
    return fetch.put(
        `${base}/update`, 
        params.entity
    ).then(res => res.data);
};

export const add = params => {
    return fetch.post(
        `${base}`,
        params
    ).then(res => res.data);
};

export const put = params => {
    return fetch.put(
        `${base}/update`,
        params
    ).then(res => res.data);
};

export const remove = params => {
    return fetch.delete(
        `${base}/` + params,
    ).then(res => res.data);
};